package com.mrd.serverconnect.ui;

import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.view.WindowManager;

import com.mrd.serverconnect.util.WifiUtils;

/**
 * Created by cww on 2020/9/17.
 */

public class BaseActivity extends AppCompatActivity {

    //private PowerManager.WakeLock wl;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        //设置无标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //设置全屏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        WifiUtils.setWifiDormancy(BaseActivity.this);//防止wifi休眠
        PowerManager pm =(PowerManager)getSystemService(Context.POWER_SERVICE);  //防止进入屏保
        //wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,"My Tag");
    }

    @Override
    protected void onResume() {
        super.onResume();

       // wl.acquire();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        //wl.release();
        super.onDestroy();
    }
}